library(brms)
Loading required package: Rcpp
Loading 'brms' package (version 2.16.1). Useful instructions
can be found by typing help('brms'). A more detailed introduction
to the package is available through vignette('brms_overview').
Attaching package: ‘brms’
The following object is masked from ‘package:lme4’:
ngrps
The following object is masked from ‘package:stats’:
ar
library(tidyr)
Attaching package: ‘tidyr’
The following objects are masked from ‘package:Matrix’:
expand, pack, unpack
library(ggplot2)
library(ggridges)
Inverse logit function for converting fitted models into binomial probabilities
logistic <- function (x)
{
p <- 1/(1 + exp(-x))
p <- ifelse(x == Inf, 1, p)
p
}
load("./updated-initial-mimicry-data.RData")
initial.mimicry.data <- initial.mimicry.data[which(!is.na(initial.mimicry.data$Correct)),]
bprior <- bprior <- c(prior_string("normal(0,1)", class = "b"))
experiment1.fitb <- brm(Correct~(Try-1)+(1|Participant), prior=bprior, data=initial.mimicry.data, family="bernoulli") # this will take longer than glmer
Compiling Stan program...
Start sampling
SAMPLING FOR MODEL '777279a8efb001aa059dd4fd0c635b9a' NOW (CHAIN 1).
Chain 1:
Chain 1: Gradient evaluation took 0.001179 seconds
Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 11.79 seconds.
Chain 1: Adjust your expectations accordingly!
Chain 1:
Chain 1:
Chain 1: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 1: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 1: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 1: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 1: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 1: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 1: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 1: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 1: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 1: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 1: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 1: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 1:
Chain 1: Elapsed Time: 7.47234 seconds (Warm-up)
Chain 1: 5.28273 seconds (Sampling)
Chain 1: 12.7551 seconds (Total)
Chain 1:
SAMPLING FOR MODEL '777279a8efb001aa059dd4fd0c635b9a' NOW (CHAIN 2).
Chain 2:
Chain 2: Gradient evaluation took 0.000401 seconds
Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 4.01 seconds.
Chain 2: Adjust your expectations accordingly!
Chain 2:
Chain 2:
Chain 2: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 2: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 2: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 2: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 2: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 2: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 2: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 2: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 2: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 2: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 2: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 2: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 2:
Chain 2: Elapsed Time: 7.20474 seconds (Warm-up)
Chain 2: 6.13622 seconds (Sampling)
Chain 2: 13.341 seconds (Total)
Chain 2:
SAMPLING FOR MODEL '777279a8efb001aa059dd4fd0c635b9a' NOW (CHAIN 3).
Chain 3:
Chain 3: Gradient evaluation took 0.000561 seconds
Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 5.61 seconds.
Chain 3: Adjust your expectations accordingly!
Chain 3:
Chain 3:
Chain 3: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 3: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 3: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 3: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 3: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 3: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 3: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 3: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 3: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 3: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 3: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 3: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 3:
Chain 3: Elapsed Time: 6.98427 seconds (Warm-up)
Chain 3: 5.76462 seconds (Sampling)
Chain 3: 12.7489 seconds (Total)
Chain 3:
SAMPLING FOR MODEL '777279a8efb001aa059dd4fd0c635b9a' NOW (CHAIN 4).
Chain 4:
Chain 4: Gradient evaluation took 0.000397 seconds
Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 3.97 seconds.
Chain 4: Adjust your expectations accordingly!
Chain 4:
Chain 4:
Chain 4: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 4: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 4: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 4: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 4: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 4: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 4: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 4: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 4: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 4: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 4: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 4: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 4:
Chain 4: Elapsed Time: 7.83292 seconds (Warm-up)
Chain 4: 5.86883 seconds (Sampling)
Chain 4: 13.7017 seconds (Total)
Chain 4:
summary(experiment1.fitb)
Family: bernoulli
Links: mu = logit
Formula: Correct ~ (Try - 1) + (1 | Participant)
Data: initial.mimicry.data (Number of observations: 8006)
Draws: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
total post-warmup draws = 4000
Group-Level Effects:
~Participant (Number of levels: 49)
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
sd(Intercept) 0.45 0.06 0.35 0.57 1.01 988 1098
Population-Level Effects:
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
TryTry1 0.66 0.07 0.51 0.81 1.00 946 1539
TryTry4 0.68 0.08 0.54 0.84 1.00 969 1355
Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
and Tail_ESS are effective sample size measures, and Rhat is the potential
scale reduction factor on split chains (at convergence, Rhat = 1).
experiment1.fit <- glmer(Correct~(Try-1)+(1|Participant), data=initial.mimicry.data, family="binomial")
summary(experiment1.fit)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: Correct ~ (Try - 1) + (1 | Participant)
Data: initial.mimicry.data
AIC BIC logLik deviance df.resid
10060.5 10081.4 -5027.2 10054.5 8003
Scaled residuals:
Min 1Q Median 3Q Max
-2.0121 -1.2003 0.6229 0.7151 1.3841
Random effects:
Groups Name Variance Std.Dev.
Participant (Intercept) 0.1817 0.4263
Number of obs: 8006, groups: Participant, 49
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
TryTry 1 0.66702 0.06902 9.665 <2e-16 ***
TryTry 4 0.69482 0.07209 9.638 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
TryTr1
TryTry 4 0.746
prior_summary(experiment1.fitb)
prior class coef group resp dpar nlpar bound source
normal(0,1) b user
normal(0,1) b TryTry1 (vectorized)
normal(0,1) b TryTry4 (vectorized)
student_t(3, 0, 2.5) sd default
student_t(3, 0, 2.5) sd Participant (vectorized)
student_t(3, 0, 2.5) sd Intercept Participant (vectorized)
#posterior predictive check
pp_check(experiment1.fitb)
Using 10 posterior draws for ppc type 'dens_overlay' by default.
# Extract MCMC samples
experiment1.fitb.post <- posterior_samples(experiment1.fitb)
Warning: Method 'posterior_samples' is deprecated. Please see ?as_draws for recommended alternatives.
# Compute CI in after conversion into probability
quantile(logistic(experiment1.fitb.post$b_TryTry1),c(0.025,0.975))
2.5% 97.5%
0.6255559 0.6910574
quantile(logistic(experiment1.fitb.post$b_TryTry4),c(0.025,0.975))
2.5% 97.5%
0.6314956 0.6979727
# Compute the CI of the *difference* betweeb the two tries
quantile(logistic(experiment1.fitb.post$b_TryTry4)-logistic(experiment1.fitb.post$b_TryTry1),c(0.025,0.975))
2.5% 97.5%
-0.01633002 0.02878057
hist(logistic(experiment1.fitb.post$b_TryTry4)-logistic(experiment1.fitb.post$b_TryTry1))
experiment1.fitb.post.long = pivot_longer(experiment1.fitb.post,cols=c(b_TryTry1,b_TryTry4))
experiment1.fitb.post.long$value = logistic(experiment1.fitb.post.long$value)
ggplot(experiment1.fitb.post.long, aes(x = value, y = name, fill = factor(stat(quantile)))) +
stat_density_ridges(
geom = "density_ridges_gradient",
calc_ecdf = TRUE,
quantiles = c(0.025, 0.975),
show.legend = FALSE,
scale = 2,
alpha = 0.7
) +
scale_y_discrete(labels = c('One','Four')) +
scale_fill_manual(name = "Posterior Probability", values = c("lightgrey", "lightblue", "lightgrey"),) +
xlab("Probability") + ylab("Try Number") +
theme_ridges()
Picking joint bandwidth of 0.00291
load("./mimicry-analyses.RData")
# convert to actual numbers
data.amal.long$Correct <- as.numeric(data.amal.long$Correct)-1
data.amal.long <- data.amal.long[!is.na(data.amal.long$Correct),]
Model for overall probability of success
iprior <- c(prior_string("normal(0,5)", class = "Intercept"))
experiment2.fit1 <- brm(Correct~1+(1|Participant), prior=iprior, data=data.amal.long, family=bernoulli)
Compiling Stan program...
Start sampling
SAMPLING FOR MODEL '2aea5ea2236cd741b07c87f3c8dce623' NOW (CHAIN 1).
Chain 1:
Chain 1: Gradient evaluation took 9.2e-05 seconds
Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.92 seconds.
Chain 1: Adjust your expectations accordingly!
Chain 1:
Chain 1:
Chain 1: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 1: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 1: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 1: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 1: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 1: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 1: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 1: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 1: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 1: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 1: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 1: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 1:
Chain 1: Elapsed Time: 2.00989 seconds (Warm-up)
Chain 1: 1.16075 seconds (Sampling)
Chain 1: 3.17064 seconds (Total)
Chain 1:
SAMPLING FOR MODEL '2aea5ea2236cd741b07c87f3c8dce623' NOW (CHAIN 2).
Chain 2:
Chain 2: Gradient evaluation took 8.8e-05 seconds
Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.88 seconds.
Chain 2: Adjust your expectations accordingly!
Chain 2:
Chain 2:
Chain 2: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 2: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 2: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 2: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 2: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 2: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 2: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 2: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 2: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 2: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 2: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 2: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 2:
Chain 2: Elapsed Time: 2.07088 seconds (Warm-up)
Chain 2: 2.43958 seconds (Sampling)
Chain 2: 4.51046 seconds (Total)
Chain 2:
SAMPLING FOR MODEL '2aea5ea2236cd741b07c87f3c8dce623' NOW (CHAIN 3).
Chain 3:
Chain 3: Gradient evaluation took 8.2e-05 seconds
Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 0.82 seconds.
Chain 3: Adjust your expectations accordingly!
Chain 3:
Chain 3:
Chain 3: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 3: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 3: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 3: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 3: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 3: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 3: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 3: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 3: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 3: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 3: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 3: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 3:
Chain 3: Elapsed Time: 2.08774 seconds (Warm-up)
Chain 3: 2.03364 seconds (Sampling)
Chain 3: 4.12139 seconds (Total)
Chain 3:
SAMPLING FOR MODEL '2aea5ea2236cd741b07c87f3c8dce623' NOW (CHAIN 4).
Chain 4:
Chain 4: Gradient evaluation took 8.1e-05 seconds
Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 0.81 seconds.
Chain 4: Adjust your expectations accordingly!
Chain 4:
Chain 4:
Chain 4: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 4: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 4: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 4: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 4: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 4: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 4: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 4: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 4: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 4: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 4: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 4: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 4:
Chain 4: Elapsed Time: 2.07084 seconds (Warm-up)
Chain 4: 1.19814 seconds (Sampling)
Chain 4: 3.26898 seconds (Total)
Chain 4:
Warning: There were 4 divergent transitions after warmup. See
http://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup
to find out why this is a problem and how to eliminate them.
Warning: Examine the pairs() plot to diagnose sampling problems
experiment2.fit1.post <- posterior_samples(experiment2.fit1)
Warning: Method 'posterior_samples' is deprecated. Please see ?as_draws for recommended alternatives.
summary(experiment2.fit1)
Warning: There were 4 divergent transitions after warmup. Increasing adapt_delta above 0.8 may help. See http://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup
Family: bernoulli
Links: mu = logit
Formula: Correct ~ 1 + (1 | Participant)
Data: data.amal.long (Number of observations: 1252)
Draws: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
total post-warmup draws = 4000
Group-Level Effects:
~Participant (Number of levels: 147)
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
sd(Intercept) 0.20 0.11 0.02 0.43 1.00 1093 2041
Population-Level Effects:
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
Intercept 0.53 0.06 0.41 0.66 1.00 4208 2561
Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
and Tail_ESS are effective sample size measures, and Rhat is the potential
scale reduction factor on split chains (at convergence, Rhat = 1).
quantile(logistic(experiment2.fit1.post$b_Intercept),c(0.025,0.975))
2.5% 97.5%
0.6014421 0.6582900
bprior <- bprior <- c(prior_string("normal(0,5)", class = "b"))
experiment2.fit1b <- brm(Correct~(Raised.General-1)+(1|Participant), prior=bprior, data=data.amal.long, family=bernoulli)
Compiling Stan program...
Start sampling
SAMPLING FOR MODEL 'b87d5b571691a2d73453300cba0cc30a' NOW (CHAIN 1).
Chain 1:
Chain 1: Gradient evaluation took 9.9e-05 seconds
Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.99 seconds.
Chain 1: Adjust your expectations accordingly!
Chain 1:
Chain 1:
Chain 1: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 1: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 1: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 1: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 1: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 1: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 1: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 1: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 1: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 1: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 1: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 1: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 1:
Chain 1: Elapsed Time: 1.84622 seconds (Warm-up)
Chain 1: 1.9597 seconds (Sampling)
Chain 1: 3.80592 seconds (Total)
Chain 1:
SAMPLING FOR MODEL 'b87d5b571691a2d73453300cba0cc30a' NOW (CHAIN 2).
Chain 2:
Chain 2: Gradient evaluation took 0.000129 seconds
Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 1.29 seconds.
Chain 2: Adjust your expectations accordingly!
Chain 2:
Chain 2:
Chain 2: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 2: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 2: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 2: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 2: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 2: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 2: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 2: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 2: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 2: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 2: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 2: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 2:
Chain 2: Elapsed Time: 1.95526 seconds (Warm-up)
Chain 2: 1.12528 seconds (Sampling)
Chain 2: 3.08054 seconds (Total)
Chain 2:
SAMPLING FOR MODEL 'b87d5b571691a2d73453300cba0cc30a' NOW (CHAIN 3).
Chain 3:
Chain 3: Gradient evaluation took 0.000126 seconds
Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 1.26 seconds.
Chain 3: Adjust your expectations accordingly!
Chain 3:
Chain 3:
Chain 3: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 3: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 3: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 3: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 3: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 3: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 3: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 3: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 3: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 3: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 3: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 3: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 3:
Chain 3: Elapsed Time: 1.68558 seconds (Warm-up)
Chain 3: 2.22794 seconds (Sampling)
Chain 3: 3.91352 seconds (Total)
Chain 3:
SAMPLING FOR MODEL 'b87d5b571691a2d73453300cba0cc30a' NOW (CHAIN 4).
Chain 4:
Chain 4: Gradient evaluation took 8.4e-05 seconds
Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 0.84 seconds.
Chain 4: Adjust your expectations accordingly!
Chain 4:
Chain 4:
Chain 4: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 4: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 4: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 4: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 4: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 4: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 4: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 4: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 4: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 4: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 4: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 4: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 4:
Chain 4: Elapsed Time: 1.67644 seconds (Warm-up)
Chain 4: 1.15072 seconds (Sampling)
Chain 4: 2.82715 seconds (Total)
Chain 4:
experiment2.fit1b.post <- posterior_samples(experiment2.fit1b)
Warning: Method 'posterior_samples' is deprecated. Please see ?as_draws for recommended alternatives.
summary(experiment2.fit1b)
Family: bernoulli
Links: mu = logit
Formula: Correct ~ (Raised.General - 1) + (1 | Participant)
Data: data.amal.long (Number of observations: 1252)
Draws: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
total post-warmup draws = 4000
Group-Level Effects:
~Participant (Number of levels: 147)
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
sd(Intercept) 0.21 0.12 0.01 0.44 1.00 950 1492
Population-Level Effects:
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
Raised.GeneralBritishIsles 0.48 0.09 0.31 0.65 1.00 4679 2702
Raised.GeneralNorthAmerica 0.46 0.13 0.20 0.70 1.00 4865 3011
Raised.GeneralRestoftheWorld 0.70 0.13 0.45 0.94 1.00 4794 2730
Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
and Tail_ESS are effective sample size measures, and Rhat is the potential
scale reduction factor on split chains (at convergence, Rhat = 1).
quantile(logistic(experiment2.fit1b.post$b_Raised.GeneralBritishIsles),c(0.025,0.975))
2.5% 97.5%
0.5772129 0.6576632
quantile(logistic(experiment2.fit1b.post$b_Raised.GeneralNorthAmerica),c(0.025,0.975))
2.5% 97.5%
0.5506386 0.6678771
quantile(logistic(experiment2.fit1b.post$b_Raised.GeneralRestoftheWorld),c(0.025,0.975))
2.5% 97.5%
0.6099336 0.7199879
#posterior predictive check
pp_check(experiment2.fit1b)
Using 10 posterior draws for ppc type 'dens_overlay' by default.
plotting out experiment 2 fit 1b
experiment2.fit1b.post.long <- pivot_longer(experiment2.fit1b.post,cols=c(b_Raised.GeneralBritishIsles,b_Raised.GeneralNorthAmerica,b_Raised.GeneralRestoftheWorld))
experiment2.fit1b.post.long$value <- logistic(experiment2.fit1b.post.long$value)
ggplot(experiment2.fit1b.post.long, aes(x = value, y = name, fill = factor(stat(quantile)))) +
stat_density_ridges(
geom = "density_ridges_gradient",
calc_ecdf = TRUE,
quantiles = c(0.025, 0.975),
show.legend = FALSE,
scale = 2,
alpha = 0.7
) +
scale_y_discrete(labels = c('British Isles','North America','Rest of the World')) +
scale_fill_manual(name = "Posterior Probability", values = c("lightgrey", "lightblue", "lightgrey"),) +
xlab("Probability") + ylab("General area raised") +
theme_ridges()
Picking joint bandwidth of 0.00446
experiment2.fit2b <- brm(Correct~Mimicry.Score+(1|Participant), prior=bprior, data=data.amal.long, family=bernoulli)
Warning: Rows containing NAs were excluded from the model.
Compiling Stan program...
Start sampling
SAMPLING FOR MODEL '3c49edce2ab6d1cc57670e5d096c75b2' NOW (CHAIN 1).
Chain 1:
Chain 1: Gradient evaluation took 6.6e-05 seconds
Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.66 seconds.
Chain 1: Adjust your expectations accordingly!
Chain 1:
Chain 1:
Chain 1: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 1: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 1: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 1: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 1: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 1: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 1: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 1: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 1: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 1: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 1: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 1: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 1:
Chain 1: Elapsed Time: 1.67004 seconds (Warm-up)
Chain 1: 0.434662 seconds (Sampling)
Chain 1: 2.10471 seconds (Total)
Chain 1:
SAMPLING FOR MODEL '3c49edce2ab6d1cc57670e5d096c75b2' NOW (CHAIN 2).
Chain 2:
Chain 2: Gradient evaluation took 3.8e-05 seconds
Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.38 seconds.
Chain 2: Adjust your expectations accordingly!
Chain 2:
Chain 2:
Chain 2: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 2: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 2: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 2: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 2: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 2: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 2: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 2: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 2: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 2: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 2: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 2: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 2:
Chain 2: Elapsed Time: 1.70198 seconds (Warm-up)
Chain 2: 0.44111 seconds (Sampling)
Chain 2: 2.14309 seconds (Total)
Chain 2:
SAMPLING FOR MODEL '3c49edce2ab6d1cc57670e5d096c75b2' NOW (CHAIN 3).
Chain 3:
Chain 3: Gradient evaluation took 3.8e-05 seconds
Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 0.38 seconds.
Chain 3: Adjust your expectations accordingly!
Chain 3:
Chain 3:
Chain 3: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 3: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 3: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 3: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 3: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 3: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 3: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 3: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 3: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 3: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 3: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 3: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 3:
Chain 3: Elapsed Time: 1.66914 seconds (Warm-up)
Chain 3: 0.446612 seconds (Sampling)
Chain 3: 2.11575 seconds (Total)
Chain 3:
SAMPLING FOR MODEL '3c49edce2ab6d1cc57670e5d096c75b2' NOW (CHAIN 4).
Chain 4:
Chain 4: Gradient evaluation took 0.000116 seconds
Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 1.16 seconds.
Chain 4: Adjust your expectations accordingly!
Chain 4:
Chain 4:
Chain 4: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 4: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 4: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 4: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 4: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 4: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 4: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 4: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 4: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 4: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 4: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 4: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 4:
Chain 4: Elapsed Time: 1.81109 seconds (Warm-up)
Chain 4: 0.464528 seconds (Sampling)
Chain 4: 2.27562 seconds (Total)
Chain 4:
summary(experiment2.fit2b)
Family: bernoulli
Links: mu = logit
Formula: Correct ~ Mimicry.Score + (1 | Participant)
Data: data.amal.long (Number of observations: 516)
Draws: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
total post-warmup draws = 4000
Group-Level Effects:
~Participant (Number of levels: 49)
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
sd(Intercept) 0.31 0.17 0.02 0.67 1.00 952 1008
Population-Level Effects:
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
Intercept 0.78 0.57 -0.30 1.93 1.00 5106 2780
Mimicry.Score -0.00 0.01 -0.02 0.01 1.00 5144 2920
Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
and Tail_ESS are effective sample size measures, and Rhat is the potential
scale reduction factor on split chains (at convergence, Rhat = 1).
quantile(logistic(experiment2.fit2b.post$b_Mimicry.Score),c(0.025,0.975))
2.5% 97.5%
0.4944419 0.5030246
#posterior predictive check
pp_check(experiment2.fit2b)
Using 10 posterior draws for ppc type 'dens_overlay' by default.
experiment2.fit3.b <- brm(Correct~Listener.Speaker.Match+(1|Participant), prior=bprior, data=data.amal.long, family=bernoulli)
Compiling Stan program...
recompiling to avoid crashing R session
Start sampling
SAMPLING FOR MODEL '3c49edce2ab6d1cc57670e5d096c75b2' NOW (CHAIN 1).
Chain 1:
Chain 1: Gradient evaluation took 9.1e-05 seconds
Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.91 seconds.
Chain 1: Adjust your expectations accordingly!
Chain 1:
Chain 1:
Chain 1: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 1: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 1: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 1: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 1: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 1: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 1: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 1: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 1: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 1: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 1: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 1: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 1:
Chain 1: Elapsed Time: 1.53677 seconds (Warm-up)
Chain 1: 1.90173 seconds (Sampling)
Chain 1: 3.4385 seconds (Total)
Chain 1:
SAMPLING FOR MODEL '3c49edce2ab6d1cc57670e5d096c75b2' NOW (CHAIN 2).
Chain 2:
Chain 2: Gradient evaluation took 7e-05 seconds
Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.7 seconds.
Chain 2: Adjust your expectations accordingly!
Chain 2:
Chain 2:
Chain 2: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 2: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 2: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 2: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 2: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 2: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 2: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 2: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 2: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 2: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 2: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 2: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 2:
Chain 2: Elapsed Time: 1.65021 seconds (Warm-up)
Chain 2: 1.01599 seconds (Sampling)
Chain 2: 2.6662 seconds (Total)
Chain 2:
SAMPLING FOR MODEL '3c49edce2ab6d1cc57670e5d096c75b2' NOW (CHAIN 3).
Chain 3:
Chain 3: Gradient evaluation took 7.4e-05 seconds
Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 0.74 seconds.
Chain 3: Adjust your expectations accordingly!
Chain 3:
Chain 3:
Chain 3: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 3: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 3: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 3: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 3: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 3: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 3: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 3: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 3: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 3: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 3: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 3: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 3:
Chain 3: Elapsed Time: 1.72065 seconds (Warm-up)
Chain 3: 1.07323 seconds (Sampling)
Chain 3: 2.79388 seconds (Total)
Chain 3:
SAMPLING FOR MODEL '3c49edce2ab6d1cc57670e5d096c75b2' NOW (CHAIN 4).
Chain 4:
Chain 4: Gradient evaluation took 7.2e-05 seconds
Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 0.72 seconds.
Chain 4: Adjust your expectations accordingly!
Chain 4:
Chain 4:
Chain 4: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 4: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 4: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 4: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 4: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 4: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 4: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 4: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 4: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 4: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 4: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 4: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 4:
Chain 4: Elapsed Time: 1.75929 seconds (Warm-up)
Chain 4: 1.99496 seconds (Sampling)
Chain 4: 3.75425 seconds (Total)
Chain 4:
experiment2.fit3.post <- posterior_samples(experiment2.fit3.b)
Warning: Method 'posterior_samples' is deprecated. Please see ?as_draws for recommended alternatives.
quantile(logistic(experiment2.fit3.post$b_Intercept),prob=c(0.025,0.975)) # Intercept Posterior i.e. when Listener.Speaker.Match=0
2.5% 97.5%
0.6329866 0.7047944
quantile(logistic(experiment2.fit3.post$b_Intercept+experiment2.fit3.post$b_Listener.Speaker.Match),prob=c(0.025,0.975)) # Posterior when b_Listener.Speaker.Match=1
2.5% 97.5%
0.5325187 0.6213355
quantile(logistic(experiment2.fit3.post$b_Intercept) - logistic(experiment2.fit3.post$b_Intercept+experiment2.fit3.post$b_Listener.Speaker.Match),prob=c(0.025,0.975)) #Posterior difference in probability of correct answer
2.5% 97.5%
0.03444616 0.14776769
summary(experiment2.fit3.b)
Family: bernoulli
Links: mu = logit
Formula: Correct ~ Listener.Speaker.Match + (1 | Participant)
Data: data.amal.long (Number of observations: 1252)
Draws: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
total post-warmup draws = 4000
Group-Level Effects:
~Participant (Number of levels: 147)
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
sd(Intercept) 0.21 0.12 0.01 0.46 1.01 902 1375
Population-Level Effects:
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
Intercept 0.70 0.08 0.55 0.87 1.00 4308 2590
Listener.Speaker.Match -0.39 0.12 -0.63 -0.15 1.00 4870 2508
Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
and Tail_ESS are effective sample size measures, and Rhat is the potential
scale reduction factor on split chains (at convergence, Rhat = 1).
pp_check(experiment2.fit3.b)
Using 10 posterior draws for ppc type 'dens_overlay' by default.
plotting model
experiment2.fit3.post$LSM <- experiment2.fit3.post$b_Intercept+experiment2.fit3.post$b_Listener.Speaker.Match
experiment2.fit3.post.long <- pivot_longer(experiment2.fit3.post,cols=c(b_Intercept,LSM))
experiment2.fit3.post.long$value <- logistic(experiment2.fit3.post.long$value)
ggplot(experiment2.fit3.post.long, aes(x = value, y = name, fill = factor(stat(quantile)))) +
stat_density_ridges(
geom = "density_ridges_gradient",
calc_ecdf = TRUE,
quantiles = c(0.025, 0.975),
show.legend = FALSE,
scale = 2,
alpha = 0.7
) +
scale_y_discrete(labels = c("No","Yes")) +
scale_fill_manual(name = "Posterior Probability", values = c("lightgrey", "lightblue", "lightgrey"),) +
xlab("Probability") + ylab("Listener-Speaker Match") +
theme_ridges()
Picking joint bandwidth of 0.00349
experiment2.fit4b <- brm(Correct~Raised.Accent.Match+(1|Participant), prior=bprior, data=data.amal.long, family=bernoulli)
Compiling Stan program...
recompiling to avoid crashing R session
Start sampling
SAMPLING FOR MODEL '3c49edce2ab6d1cc57670e5d096c75b2' NOW (CHAIN 1).
Chain 1:
Chain 1: Gradient evaluation took 0.000198 seconds
Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 1.98 seconds.
Chain 1: Adjust your expectations accordingly!
Chain 1:
Chain 1:
Chain 1: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 1: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 1: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 1: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 1: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 1: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 1: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 1: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 1: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 1: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 1: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 1: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 1:
Chain 1: Elapsed Time: 1.78323 seconds (Warm-up)
Chain 1: 1.98665 seconds (Sampling)
Chain 1: 3.76988 seconds (Total)
Chain 1:
SAMPLING FOR MODEL '3c49edce2ab6d1cc57670e5d096c75b2' NOW (CHAIN 2).
Chain 2:
Chain 2: Gradient evaluation took 9.2e-05 seconds
Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.92 seconds.
Chain 2: Adjust your expectations accordingly!
Chain 2:
Chain 2:
Chain 2: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 2: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 2: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 2: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 2: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 2: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 2: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 2: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 2: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 2: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 2: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 2: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 2:
Chain 2: Elapsed Time: 1.69445 seconds (Warm-up)
Chain 2: 1.0396 seconds (Sampling)
Chain 2: 2.73405 seconds (Total)
Chain 2:
SAMPLING FOR MODEL '3c49edce2ab6d1cc57670e5d096c75b2' NOW (CHAIN 3).
Chain 3:
Chain 3: Gradient evaluation took 9.8e-05 seconds
Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 0.98 seconds.
Chain 3: Adjust your expectations accordingly!
Chain 3:
Chain 3:
Chain 3: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 3: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 3: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 3: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 3: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 3: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 3: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 3: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 3: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 3: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 3: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 3: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 3:
Chain 3: Elapsed Time: 1.89521 seconds (Warm-up)
Chain 3: 1.05444 seconds (Sampling)
Chain 3: 2.94965 seconds (Total)
Chain 3:
SAMPLING FOR MODEL '3c49edce2ab6d1cc57670e5d096c75b2' NOW (CHAIN 4).
Chain 4:
Chain 4: Gradient evaluation took 0.00015 seconds
Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 1.5 seconds.
Chain 4: Adjust your expectations accordingly!
Chain 4:
Chain 4:
Chain 4: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 4: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 4: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 4: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 4: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 4: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 4: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 4: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 4: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 4: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 4: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 4: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 4:
Chain 4: Elapsed Time: 1.66437 seconds (Warm-up)
Chain 4: 1.01846 seconds (Sampling)
Chain 4: 2.68283 seconds (Total)
Chain 4:
Warning: There were 2 divergent transitions after warmup. See
http://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup
to find out why this is a problem and how to eliminate them.
Warning: Examine the pairs() plot to diagnose sampling problems
experiment2.fit4.post <- posterior_samples(experiment2.fit4b)
Warning: Method 'posterior_samples' is deprecated. Please see ?as_draws for recommended alternatives.
quantile(logistic(experiment2.fit4.post$b_Intercept),prob=c(0.025,0.975)) # Intercept Posterior
2.5% 97.5%
0.6097672 0.6813327
quantile(logistic(experiment2.fit4.post$b_Intercept+experiment2.fit4.post$b_Raised.Accent.Match),prob=c(0.025,0.975)) # Posterior when b_Raised.Accent.Match=1
2.5% 97.5%
0.5590427 0.6515391
quantile(logistic(experiment2.fit4.post$b_Intercept) - logistic(experiment2.fit4.post$b_Intercept+experiment2.fit4.post$b_Raised.Accent.Match),prob=c(0.025,0.975)) #Posterior difference in probability of correct answer
2.5% 97.5%
-0.01802452 0.09636362
#evaluating divergences
pairs(experiment2.fit4b, las = 1)
Warning: The following arguments were unrecognized and ignored: las
summary(experiment2.fit4b)
Warning: There were 5 divergent transitions after warmup. Increasing adapt_delta above 0.8 may help. See http://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup
Family: bernoulli
Links: mu = logit
Formula: Correct ~ Raised.Accent.Match + (1 | Participant)
Data: data.amal.long (Number of observations: 1252)
Draws: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
total post-warmup draws = 4000
Group-Level Effects:
~Participant (Number of levels: 147)
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
sd(Intercept) 0.19 0.12 0.01 0.43 1.01 640 1666
Population-Level Effects:
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
Intercept 0.59 0.08 0.44 0.75 1.00 4282 2427
Raised.Accent.Match -0.17 0.13 -0.42 0.08 1.00 4934 2588
Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
and Tail_ESS are effective sample size measures, and Rhat is the potential
scale reduction factor on split chains (at convergence, Rhat = 1).
pp_check(experiment2.fit4b)
Using 10 posterior draws for ppc type 'dens_overlay' by default.
experiment2.fit5b <- brm(Correct~ (Raised.General-1) * Listener.Speaker.Match + (1|Participant), prior=bprior, data=data.amal.long, family=bernoulli)
Compiling Stan program...
recompiling to avoid crashing R session
Start sampling
SAMPLING FOR MODEL 'b87d5b571691a2d73453300cba0cc30a' NOW (CHAIN 1).
Chain 1:
Chain 1: Gradient evaluation took 0.000101 seconds
Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 1.01 seconds.
Chain 1: Adjust your expectations accordingly!
Chain 1:
Chain 1:
Chain 1: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 1: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 1: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 1: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 1: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 1: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 1: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 1: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 1: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 1: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 1: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 1: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 1:
Chain 1: Elapsed Time: 1.99406 seconds (Warm-up)
Chain 1: 1.1332 seconds (Sampling)
Chain 1: 3.12726 seconds (Total)
Chain 1:
SAMPLING FOR MODEL 'b87d5b571691a2d73453300cba0cc30a' NOW (CHAIN 2).
Chain 2:
Chain 2: Gradient evaluation took 0.000112 seconds
Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 1.12 seconds.
Chain 2: Adjust your expectations accordingly!
Chain 2:
Chain 2:
Chain 2: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 2: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 2: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 2: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 2: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 2: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 2: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 2: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 2: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 2: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 2: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 2: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 2:
Chain 2: Elapsed Time: 2.11137 seconds (Warm-up)
Chain 2: 1.11253 seconds (Sampling)
Chain 2: 3.2239 seconds (Total)
Chain 2:
SAMPLING FOR MODEL 'b87d5b571691a2d73453300cba0cc30a' NOW (CHAIN 3).
Chain 3:
Chain 3: Gradient evaluation took 8.2e-05 seconds
Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 0.82 seconds.
Chain 3: Adjust your expectations accordingly!
Chain 3:
Chain 3:
Chain 3: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 3: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 3: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 3: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 3: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 3: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 3: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 3: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 3: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 3: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 3: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 3: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 3:
Chain 3: Elapsed Time: 2.08776 seconds (Warm-up)
Chain 3: 1.13353 seconds (Sampling)
Chain 3: 3.22129 seconds (Total)
Chain 3:
SAMPLING FOR MODEL 'b87d5b571691a2d73453300cba0cc30a' NOW (CHAIN 4).
Chain 4:
Chain 4: Gradient evaluation took 7.9e-05 seconds
Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 0.79 seconds.
Chain 4: Adjust your expectations accordingly!
Chain 4:
Chain 4:
Chain 4: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 4: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 4: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 4: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 4: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 4: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 4: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 4: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 4: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 4: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 4: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 4: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 4:
Chain 4: Elapsed Time: 1.77877 seconds (Warm-up)
Chain 4: 1.1301 seconds (Sampling)
Chain 4: 2.90886 seconds (Total)
Chain 4:
summary(experiment2.fit5b)
Family: bernoulli
Links: mu = logit
Formula: Correct ~ (Raised.General - 1) * Listener.Speaker.Match + (1 | Participant)
Data: data.amal.long (Number of observations: 1252)
Draws: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
total post-warmup draws = 4000
Group-Level Effects:
~Participant (Number of levels: 147)
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
sd(Intercept) 0.21 0.12 0.01 0.45 1.01 676 1162
Population-Level Effects:
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
Raised.GeneralBritishIsles 1.01 0.17 0.67 1.35 1.00 1884 2443
Raised.GeneralNorthAmerica 0.44 0.14 0.17 0.72 1.00 3460 2728
Raised.GeneralRestoftheWorld 0.76 0.13 0.51 1.02 1.00 3603 2766
Listener.Speaker.Match -0.71 0.20 -1.09 -0.32 1.00 1806 2269
Raised.GeneralNorthAmerica:Listener.Speaker.Match 0.80 0.39 0.07 1.59 1.00 2470 2954
Raised.GeneralRestoftheWorld:Listener.Speaker.Match 0.08 0.42 -0.72 0.92 1.00 2527 2411
Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
and Tail_ESS are effective sample size measures, and Rhat is the potential
scale reduction factor on split chains (at convergence, Rhat = 1).
experiment2.fit5.post <- posterior_samples(experiment2.fit5b)[,1:7]
Warning: Method 'posterior_samples' is deprecated. Please see ?as_draws for recommended alternatives.
pp_check(experiment2.fit5b)
Using 10 posterior draws for ppc type 'dens_overlay' by default.
#British Isle, No Listener Speaker Match
quantile(logistic(experiment2.fit5.post$b_Raised.GeneralBritishIsles),c(0.025,0.975))
2.5% 97.5%
0.6624766 0.7937186
#British Isle, Listener Speaker Match
quantile(logistic(experiment2.fit5.post$b_Raised.GeneralBritishIsles+experiment2.fit5.post$b_Listener.Speaker.Match),c(0.025,0.975))
2.5% 97.5%
0.5246164 0.6214881
#NorthAmerica, No Listener Speaker Match
quantile(logistic(experiment2.fit5.post$b_Raised.GeneralNorthAmerica),c(0.025,0.975))
2.5% 97.5%
0.5423182 0.6735195
#NorthAmerica, Listener Speaker Match
quantile(logistic(experiment2.fit5.post$`b_Raised.GeneralNorthAmerica`+experiment2.fit5.post$`b_Listener.Speaker.Match`+experiment2.fit5.post$`b_Raised.GeneralNorthAmerica:Listener.Speaker.Match`),c(0.025,0.975))
2.5% 97.5%
0.4921926 0.7560025
#RestoftheWorld, No Listener Speaker Match
quantile(logistic(experiment2.fit5.post$b_Raised.GeneralRestoftheWorld),c(0.025,0.975))
2.5% 97.5%
0.6249040 0.7349015
#RestoftheWorld, Listener Speaker Match
quantile(logistic(experiment2.fit5.post$`b_Raised.GeneralRestoftheWorld`+experiment2.fit5.post$`b_Listener.Speaker.Match`+experiment2.fit5.post$`b_Raised.GeneralRestoftheWorld:Listener.Speaker.Match`),c(0.025,0.975))
2.5% 97.5%
0.3604592 0.7000265
plotting model
experiment2.fit5.post$Raised.General.BI.LSM <- experiment2.fit5.post$b_Raised.GeneralBritishIsles+experiment2.fit5.post$b_Listener.Speaker.Match
experiment2.fit5.post$Raised.General.NA.LSM <- experiment2.fit5.post$`b_Raised.GeneralNorthAmerica`+experiment2.fit5.post$`b_Listener.Speaker.Match`+experiment2.fit5.post$`b_Raised.GeneralNorthAmerica:Listener.Speaker.Match`
experiment2.fit5.post$Raised.General.RW.LSM <- experiment2.fit5.post$`b_Raised.GeneralRestoftheWorld`+experiment2.fit5.post$`b_Listener.Speaker.Match`+experiment2.fit5.post$`b_Raised.GeneralRestoftheWorld:Listener.Speaker.Match`
experiment2.fit5.post.long <- pivot_longer(experiment2.fit5.post,cols=c(b_Raised.GeneralBritishIsles,Raised.General.BI.LSM,b_Raised.GeneralNorthAmerica,Raised.General.NA.LSM,b_Raised.GeneralRestoftheWorld,Raised.General.RW.LSM))
experiment2.fit5.post.long$value <- logistic(experiment2.fit5.post.long$value)
ggplot(experiment2.fit5.post.long, aes(x = value, y = name, fill = factor(stat(quantile)))) +
stat_density_ridges(
geom = "density_ridges_gradient",
calc_ecdf = TRUE,
quantiles = c(0.025, 0.975),
show.legend = FALSE,
scale = 2,
alpha = 0.7
) +
scale_y_discrete(labels = c("British Isles, No","British Isles, Yes","North America, No","North America, Yes","Rest of the World, No","Rest of the World, Yes")) +
scale_fill_manual(name = "Posterior Probability", values = c("lightgrey", "lightblue", "lightgrey"),) +
xlab("Probability") + ylab("Region and Listener-Speaker Match") +
theme_ridges()
Picking joint bandwidth of 0.00777
# there are no Rest of the World Partecipants with Raised Accent Match ==1 so dropping the level
data.amal.long2 <- subset(data.amal.long, Raised.General!='Rest of the World')
data.amal.long2$Raised.General = as.character(data.amal.long2$Raised.General)
experiment2.fit6b <- brm(Correct~ (Raised.General-1) * Raised.Accent.Match +(1|Participant), prior=bprior, data=data.amal.long2, family=bernoulli)
Compiling Stan program...
recompiling to avoid crashing R session
Start sampling
SAMPLING FOR MODEL 'b87d5b571691a2d73453300cba0cc30a' NOW (CHAIN 1).
Chain 1:
Chain 1: Gradient evaluation took 8.2e-05 seconds
Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.82 seconds.
Chain 1: Adjust your expectations accordingly!
Chain 1:
Chain 1:
Chain 1: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 1: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 1: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 1: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 1: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 1: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 1: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 1: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 1: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 1: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 1: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 1: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 1:
Chain 1: Elapsed Time: 1.3818 seconds (Warm-up)
Chain 1: 0.904745 seconds (Sampling)
Chain 1: 2.28655 seconds (Total)
Chain 1:
SAMPLING FOR MODEL 'b87d5b571691a2d73453300cba0cc30a' NOW (CHAIN 2).
Chain 2:
Chain 2: Gradient evaluation took 7e-05 seconds
Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.7 seconds.
Chain 2: Adjust your expectations accordingly!
Chain 2:
Chain 2:
Chain 2: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 2: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 2: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 2: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 2: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 2: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 2: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 2: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 2: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 2: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 2: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 2: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 2:
Chain 2: Elapsed Time: 1.33585 seconds (Warm-up)
Chain 2: 0.878154 seconds (Sampling)
Chain 2: 2.21401 seconds (Total)
Chain 2:
SAMPLING FOR MODEL 'b87d5b571691a2d73453300cba0cc30a' NOW (CHAIN 3).
Chain 3:
Chain 3: Gradient evaluation took 6.4e-05 seconds
Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 0.64 seconds.
Chain 3: Adjust your expectations accordingly!
Chain 3:
Chain 3:
Chain 3: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 3: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 3: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 3: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 3: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 3: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 3: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 3: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 3: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 3: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 3: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 3: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 3:
Chain 3: Elapsed Time: 1.30053 seconds (Warm-up)
Chain 3: 1.59002 seconds (Sampling)
Chain 3: 2.89055 seconds (Total)
Chain 3:
SAMPLING FOR MODEL 'b87d5b571691a2d73453300cba0cc30a' NOW (CHAIN 4).
Chain 4:
Chain 4: Gradient evaluation took 6.2e-05 seconds
Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 0.62 seconds.
Chain 4: Adjust your expectations accordingly!
Chain 4:
Chain 4:
Chain 4: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 4: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 4: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 4: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 4: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 4: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 4: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 4: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 4: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 4: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 4: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 4: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 4:
Chain 4: Elapsed Time: 1.47945 seconds (Warm-up)
Chain 4: 1.02577 seconds (Sampling)
Chain 4: 2.50522 seconds (Total)
Chain 4:
summary(experiment2.fit6b)
Family: bernoulli
Links: mu = logit
Formula: Correct ~ (Raised.General - 1) * Raised.Accent.Match + (1 | Participant)
Data: data.amal.long2 (Number of observations: 912)
Draws: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
total post-warmup draws = 4000
Group-Level Effects:
~Participant (Number of levels: 110)
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
sd(Intercept) 0.18 0.12 0.01 0.43 1.00 957 1644
Population-Level Effects:
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
Raised.GeneralBritishIsles 0.62 0.13 0.37 0.89 1.00 2445 2806
Raised.GeneralNorthAmerica 0.38 0.16 0.06 0.70 1.00 4441 3140
Raised.Accent.Match -0.25 0.17 -0.59 0.09 1.00 2278 2791
Raised.GeneralNorthAmerica:Raised.Accent.Match 0.43 0.30 -0.15 1.02 1.00 2715 2747
Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
and Tail_ESS are effective sample size measures, and Rhat is the potential
scale reduction factor on split chains (at convergence, Rhat = 1).
experiment2.fit6.post <- posterior_samples(experiment2.fit6b)
Warning: Method 'posterior_samples' is deprecated. Please see ?as_draws for recommended alternatives.
pp_check(experiment2.fit6b)
Using 10 posterior draws for ppc type 'dens_overlay' by default.
#British Isle, No Raised.Accent.Match
quantile(logistic(experiment2.fit6.post$b_Raised.GeneralBritishIsles),c(0.025,0.975))
2.5% 97.5%
0.5922590 0.7088123
#British Isle, Raised.Accent.Match
quantile(logistic(experiment2.fit6.post$b_Raised.GeneralBritishIsles+experiment2.fit6.post$b_Raised.Accent.Match),c(0.025,0.975))
2.5% 97.5%
0.5369874 0.6455197
#NorthAmerica, No Raised.Accent.Match
quantile(logistic(experiment2.fit6.post$b_Raised.GeneralNorthAmerica),c(0.025,0.975))
2.5% 97.5%
0.5157085 0.6681039
#NorthAmerica, Raised.Accent.Match
quantile(logistic(experiment2.fit6.post$`b_Raised.GeneralNorthAmerica`+experiment2.fit6.post$`b_Raised.Accent.Match`+experiment2.fit6.post$`b_Raised.GeneralNorthAmerica:Raised.Accent.Match`),c(0.025,0.975))
2.5% 97.5%
0.5490473 0.7185427
plotting model
experiment2.fit6.post$Raised.General.BI.RAM <- experiment2.fit6.post$b_Raised.GeneralBritishIsles+experiment2.fit6.post$b_Raised.Accent.Match
experiment2.fit6.post$Raised.General.NA.RAM <- experiment2.fit6.post$`b_Raised.GeneralNorthAmerica`+experiment2.fit6.post$`b_Raised.Accent.Match`+experiment2.fit6.post$`b_Raised.GeneralNorthAmerica:Raised.Accent.Match`
experiment2.fit6.post.long <- pivot_longer(experiment2.fit6.post,cols=c(b_Raised.GeneralBritishIsles,Raised.General.BI.RAM,b_Raised.GeneralNorthAmerica,Raised.General.NA.RAM))
experiment2.fit6.post.long$value <- logistic(experiment2.fit6.post.long$value)
ggplot(experiment2.fit6.post.long, aes(x = value, y = name, fill = factor(stat(quantile)))) +
stat_density_ridges(
geom = "density_ridges_gradient",
calc_ecdf = TRUE,
quantiles = c(0.025, 0.975),
show.legend = FALSE,
scale = 2,
alpha = 0.7
) +
scale_y_discrete(labels = c("British Isles, No","British Isles, Yes","North America, No","North America, Yes")) +
scale_fill_manual(name = "Posterior Probability", values = c("lightgrey", "lightblue", "lightgrey"),) +
xlab("Probability") + ylab("Region and Listener-Accent Match") +
theme_ridges()
Picking joint bandwidth of 0.00596
#Evaluate detection in experiment 2 by quality of fake according to scoring system in experiment 1
experiment2.questions <- data.frame(Q=c(1:12), Fake.quality=c(100,80,60,"Not Fake","Not Fake",100,"Not Fake",87.5,80,"Not Fake","Not Fake","Not Fake"))
experiment2.questions$Fake.quality <- factor(experiment2.questions$Fake.quality, levels=c("Not Fake",60,80,87.5,100))
data.amal.long.temp$Fake.quality <- rep(experiment2.questions$Fake.quality, 147)
# convert to actual numbers
data.amal.long.temp$Correct <- as.numeric(data.amal.long.temp$Correct)-1
data.amal.long <- data.amal.long.temp[!is.na(data.amal.long.temp$Correct),]
experiment2.fit7 <- brm(Correct~(Fake.quality-1)+(1|Participant), prior=bprior, data=data.amal.long, family=bernoulli)
Compiling Stan program...
recompiling to avoid crashing R session
Start sampling
SAMPLING FOR MODEL 'b87d5b571691a2d73453300cba0cc30a' NOW (CHAIN 1).
Chain 1:
Chain 1: Gradient evaluation took 9.7e-05 seconds
Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.97 seconds.
Chain 1: Adjust your expectations accordingly!
Chain 1:
Chain 1:
Chain 1: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 1: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 1: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 1: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 1: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 1: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 1: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 1: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 1: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 1: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 1: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 1: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 1:
Chain 1: Elapsed Time: 1.96279 seconds (Warm-up)
Chain 1: 1.52971 seconds (Sampling)
Chain 1: 3.4925 seconds (Total)
Chain 1:
SAMPLING FOR MODEL 'b87d5b571691a2d73453300cba0cc30a' NOW (CHAIN 2).
Chain 2:
Chain 2: Gradient evaluation took 0.000174 seconds
Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 1.74 seconds.
Chain 2: Adjust your expectations accordingly!
Chain 2:
Chain 2:
Chain 2: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 2: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 2: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 2: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 2: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 2: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 2: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 2: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 2: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 2: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 2: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 2: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 2:
Chain 2: Elapsed Time: 1.90653 seconds (Warm-up)
Chain 2: 1.80096 seconds (Sampling)
Chain 2: 3.70749 seconds (Total)
Chain 2:
SAMPLING FOR MODEL 'b87d5b571691a2d73453300cba0cc30a' NOW (CHAIN 3).
Chain 3:
Chain 3: Gradient evaluation took 7.9e-05 seconds
Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 0.79 seconds.
Chain 3: Adjust your expectations accordingly!
Chain 3:
Chain 3:
Chain 3: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 3: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 3: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 3: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 3: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 3: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 3: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 3: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 3: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 3: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 3: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 3: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 3:
Chain 3: Elapsed Time: 1.87842 seconds (Warm-up)
Chain 3: 1.13701 seconds (Sampling)
Chain 3: 3.01543 seconds (Total)
Chain 3:
SAMPLING FOR MODEL 'b87d5b571691a2d73453300cba0cc30a' NOW (CHAIN 4).
Chain 4:
Chain 4: Gradient evaluation took 0.000118 seconds
Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 1.18 seconds.
Chain 4: Adjust your expectations accordingly!
Chain 4:
Chain 4:
Chain 4: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 4: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 4: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 4: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 4: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 4: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 4: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 4: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 4: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 4: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 4: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 4: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 4:
Chain 4: Elapsed Time: 1.90253 seconds (Warm-up)
Chain 4: 1.31274 seconds (Sampling)
Chain 4: 3.21527 seconds (Total)
Chain 4:
Warning: There were 1 divergent transitions after warmup. See
http://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup
to find out why this is a problem and how to eliminate them.
Warning: Examine the pairs() plot to diagnose sampling problems
experiment2.fit7.post <- posterior_samples(experiment2.fit7)
Warning: Method 'posterior_samples' is deprecated. Please see ?as_draws for recommended alternatives.
summary(experiment2.fit7)
Warning: There were 1 divergent transitions after warmup. Increasing adapt_delta above 0.8 may help. See http://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup
Family: bernoulli
Links: mu = logit
Formula: Correct ~ (Fake.quality - 1) + (1 | Participant)
Data: data.amal.long (Number of observations: 1252)
Draws: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
total post-warmup draws = 4000
Group-Level Effects:
~Participant (Number of levels: 147)
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
sd(Intercept) 0.23 0.12 0.02 0.47 1.01 756 1727
Population-Level Effects:
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
Fake.qualityNotFake 0.45 0.09 0.28 0.62 1.00 4367 2744
Fake.quality60 -0.35 0.21 -0.78 0.05 1.00 4012 2648
Fake.quality80 0.93 0.15 0.63 1.23 1.00 3964 2775
Fake.quality87.5 1.14 0.25 0.68 1.64 1.00 4396 2639
Fake.quality100 0.60 0.14 0.33 0.88 1.00 4731 2361
Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
and Tail_ESS are effective sample size measures, and Rhat is the potential
scale reduction factor on split chains (at convergence, Rhat = 1).
pp_check(experiment2.fit7)
Using 10 posterior draws for ppc type 'dens_overlay' by default.
#evaluating divergences
pairs(experiment2.fit7, las = 1)
Warning: The following arguments were unrecognized and ignored: las
#confidence intervals
#Not Fake
quantile(logistic(experiment2.fit7.post$b_Fake.qualityNotFake),c(0.025,0.975))
2.5% 97.5%
0.5706674 0.6513117
#60
quantile(logistic(experiment2.fit7.post$b_Fake.quality60),c(0.025,0.975))
2.5% 97.5%
0.3138667 0.5121018
#80
quantile(logistic(experiment2.fit7.post$b_Fake.quality80),c(0.025,0.975))
2.5% 97.5%
0.6530918 0.7743257
#87.5
quantile(logistic(experiment2.fit7.post$b_Fake.quality87.5),c(0.025,0.975))
2.5% 97.5%
0.6632454 0.8377182
#100
quantile(logistic(experiment2.fit7.post$b_Fake.quality100),c(0.025,0.975))
2.5% 97.5%
0.5810652 0.7058803
#plotting
experiment2.fit7.post.long <- pivot_longer(experiment2.fit7.post,cols=c(b_Fake.qualityNotFake,b_Fake.quality60,b_Fake.quality80,b_Fake.quality87.5,b_Fake.quality100))
experiment2.fit7.post.long$value <- logistic(experiment2.fit7.post.long$value)
ggplot(experiment2.fit7.post.long, aes(x = value, y = name, fill = factor(stat(quantile)))) +
stat_density_ridges(
geom = "density_ridges_gradient",
calc_ecdf = TRUE,
quantiles = c(0.025, 0.975),
show.legend = FALSE,
scale = 2,
alpha = 0.7
) +
scale_y_discrete(labels = c("Genuine speaker","60% correct","80% correct","87.5% correct","100% correct")) +
scale_fill_manual(name = "Posterior Probability", values = c("lightgrey", "lightblue", "lightgrey"),) +
xlab("Probability") + ylab("Quality of mimicry") +
theme_ridges()
Picking joint bandwidth of 0.00614